debian-build-debug:
  image: debian
  stage: build
  tags:
    - docker
  before_script:
    - apt update && apt -y install make libxml++2.6-dev g++
  script:
    - NPROC=$(nproc)
    - echo "Using '$NPROC' processes to build source..."
    - make debug -j$NPROC
  rules:
    - if: '$CI_COMMIT_REF_NAME =~ $CI_DEFAULT_BRANCH'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]\.[A-F]$/'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]+\-/'
      when: manual
      allow_failure: true

debian-build-release:
  image: debian
  stage: build
  tags:
    - docker
  before_script:
    - apt update && apt -y install make libxml++2.6-dev g++
  script:
    - NPROC=$(nproc)
    - echo "Using '$NPROC' processes to build source..."
    - make release -j$NPROC
    - make install
  artifacts:
    paths:
      - src/artlibgen/src/artlibgen
      - src/artrepgen/artrepgen
      - src/artlibgen/templates/
  cache:
    paths:
      - "src/artrepgen/*.o"
      - "src/libs/libtplreader/*.o"
      - "src/artlibgen/src/*.o"
  rules:
    - if: '$CI_COMMIT_REF_NAME =~ $CI_DEFAULT_BRANCH'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]\.[A-F]$/'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]+\-/'
      when: manual
      allow_failure: true

debian-test-file:
  image: debian
  stage: test
  tags:
    - docker
  before_script:
    - apt update && apt -y install make libxml++2.6-2v5 gcc
  script:
    - make install
    - cd regressions/features && make tracefile-method
  dependencies:
    - debian-build-release
  rules:
    - if: '$CI_COMMIT_REF_NAME =~ $CI_DEFAULT_BRANCH'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]\.[A-F]$/'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]+\-/'
      when: manual
      allow_failure: true

debian-test-networked:
  image: debian
  stage: test
  tags:
    - docker
  before_script:
    - apt update && apt -y install make libxml++2.6-2v5 psmisc gcc
  script:
    - make install
    - cd regressions/features && make networked-method
  dependencies:
    - debian-build-release
  rules:
    - if: '$CI_COMMIT_REF_NAME =~ $CI_DEFAULT_BRANCH'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]\.[A-F]$/'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^[0-9]+\-/'
      when: manual
      allow_failure: true
